<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    var Stones = function (J, S) {
      const set = new Set();
      for (const s of J) {
        set.add(s);
      }
      let ans = 0;
      for (const s of S) {
        if (set.has(s)) {
          ans++;
        }
      }
      return ans;
    };
    console.log(Stones(J = "aA", S = "aAAbbbb"))
  </script>
</body>

</html>